package org.icnmasjid.member.model;

import java.util.HashSet;
import java.util.Set;
// Generated Feb 5, 2008 8:40:41 AM by Hibernate Tools 3.1.0.beta4



/**
 * @struts.form include-all="true" extends="BaseForm"
 * @hibernate.class
 *         table="address"
 *
 */

public class Address extends org.icnmasjid.member.model.BaseObject implements java.io.Serializable {


    // Fields

    private Integer id;
    private String type;
    private String address1;
    private String address2;
    private String city;
    private String state;
    private String zip;
    private String county;
    private Set<Person> persons = new HashSet<Person>();


    // Constructors

    /** default constructor */
    public Address() {
    }


    /** full constructor */
    public Address(String addType, String addAddress1, String addAddress2, String addCity, String addState, String addZip, String addCounty) {
        this.type = addType;
        this.address1 = addAddress1;
        this.address2 = addAddress2;
        this.city = addCity;
        this.state = addState;
        this.zip = addZip;
        this.county = addCounty;
    }



    // Property accessors
	/**
     *            @hibernate.set
     *             lazy="true"
     *             inverse="true"
     *             table="person_address"
     *            @hibernate.key
     *             column="address_id"
     *             not-null="true"
     *            @hibernate.many-to-many
     *             column="person_id"
     *             class="org.icnmasjid.member.model.Person"
     *
     */
    public Set<Person> getPersons() {
		return persons;
	}


	public void setPersons(Set<Person> persons) {
		this.persons = persons;
	}



    /**
     *      *            @hibernate.id
     *             generator-class="native"
     *             type="java.lang.Integer"
     *             column="add_id"
     *
     */

    public Integer getId() {
        return this.id;
    }

    public void setId(Integer addId) {
        this.id = addId;
    }
    /**
     *      *            @hibernate.property
     *             column="add_type"
     *             length="100"
     *
     */

    public String getType() {
        return this.type;
    }

    public void setType(String addType) {
        this.type = addType;
    }
    /**
     *      *            @hibernate.property
     *             column="add_address1"
     *             length="100"
     *
     */

    public String getAddress1() {
        return this.address1;
    }

    public void setAddress1(String addAddress1) {
        this.address1 = addAddress1;
    }
    /**
     *      *            @hibernate.property
     *             column="add_address2"
     *             length="100"
     *
     */

    public String getAddress2() {
        return this.address2;
    }

    public void setAddress2(String addAddress2) {
        this.address2 = addAddress2;
    }
    /**
     *      *            @hibernate.property
     *             column="add_city"
     *             length="100"
     *
     */

    public String getCity() {
        return this.city;
    }

    public void setCity(String addCity) {
        this.city = addCity;
    }
    /**
     *      *            @hibernate.property
     *             column="add_state"
     *             length="100"
     *
     */

    public String getState() {
        return this.state;
    }

    public void setState(String addState) {
        this.state = addState;
    }
    /**
     *      *            @hibernate.property
     *             column="add_zip"
     *             length="100"
     *
     */

    public String getZip() {
        return this.zip;
    }

    public void setZip(String addZip) {
        this.zip = addZip;
    }
    /**
     *      *            @hibernate.property
     *             column="add_county"
     *             length="100"
     *
     */

    public String getCounty() {
        return this.county;
    }

    public void setCounty(String addCounty) {
        this.county = addCounty;
    }


    /**
     * toString
     * @return String
     */
     public String toString() {
	  StringBuffer buffer = new StringBuffer();

      buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" [");
      buffer.append("type").append("='").append(getType()).append("' ");
      buffer.append("address1").append("='").append(getAddress1()).append("' ");
      buffer.append("address2").append("='").append(getAddress2()).append("' ");
      buffer.append("city").append("='").append(getCity()).append("' ");
      buffer.append("state").append("='").append(getState()).append("' ");
      buffer.append("zip").append("='").append(getZip()).append("' ");
      buffer.append("county").append("='").append(getCounty()).append("' ");
      buffer.append("]");

      return buffer.toString();
     }


   public boolean equals(Object other) {
         if ( (this == other ) ) return true;
		 if ( (other == null ) ) return false;
		 if ( !(other instanceof Address) ) return false;
		 Address castOther = ( Address ) other;

		 return ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) )
 && ( (this.getType()==castOther.getType()) || ( this.getType()!=null && castOther.getType()!=null && this.getType().equals(castOther.getType()) ) )
 && ( (this.getAddress1()==castOther.getAddress1()) || ( this.getAddress1()!=null && castOther.getAddress1()!=null && this.getAddress1().equals(castOther.getAddress1()) ) )
 && ( (this.getAddress2()==castOther.getAddress2()) || ( this.getAddress2()!=null && castOther.getAddress2()!=null && this.getAddress2().equals(castOther.getAddress2()) ) )
 && ( (this.getCity()==castOther.getCity()) || ( this.getCity()!=null && castOther.getCity()!=null && this.getCity().equals(castOther.getCity()) ) )
 && ( (this.getState()==castOther.getState()) || ( this.getState()!=null && castOther.getState()!=null && this.getState().equals(castOther.getState()) ) )
 && ( (this.getZip()==castOther.getZip()) || ( this.getZip()!=null && castOther.getZip()!=null && this.getZip().equals(castOther.getZip()) ) )
 && ( (this.getCounty()==castOther.getCounty()) || ( this.getCounty()!=null && castOther.getCounty()!=null && this.getCounty().equals(castOther.getCounty()) ) );
   }

   public int hashCode() {
         int result = 17;

         result = 37 * result + ( getId() == null ? 0 : this.getId().hashCode() );
         result = 37 * result + ( getType() == null ? 0 : this.getType().hashCode() );
         result = 37 * result + ( getAddress1() == null ? 0 : this.getAddress1().hashCode() );
         result = 37 * result + ( getAddress2() == null ? 0 : this.getAddress2().hashCode() );
         result = 37 * result + ( getCity() == null ? 0 : this.getCity().hashCode() );
         result = 37 * result + ( getState() == null ? 0 : this.getState().hashCode() );
         result = 37 * result + ( getZip() == null ? 0 : this.getZip().hashCode() );
         result = 37 * result + ( getCounty() == null ? 0 : this.getCounty().hashCode() );
         return result;
   }


	public void addPerson(Person person) {
		getPersons().add(person);
	}

}
